Once you have a signer, you can use it to send transactions.
Copy
Ask AI
import { getSigner } from "./signer";async function sendTransaction(chainId: string, to: string, value: string, data: string) { // Get the signer for the specified chain const signer = await getSigner(chainId); // Send the transaction const tx = await signer.sendTransaction({ to, value, data }); // Wait for the transaction to be mined const receipt = await tx.wait(); if (receipt?.status === 0) { throw new Error('Transaction reverted'); } return { txHash: receipt?.hash, contractAddress: receipt?.contractAddress, txUrl: `https://${chainId}.etherscan.io/tx/${receipt?.hash}` };}async function sendTransactionBatch(chainId: string, transactions: { to: string, value: string, data: string }[]) { // Get the signer for the specified chain const signer = await getSigner(chainId); // Send the transaction batch const tx = await signer.sendTransaction(transactions); // Wait for the transaction to be mined const receipt = await tx.wait(); if (receipt?.status === 0) { throw new Error('Transaction reverted'); } return { txHash: receipt?.hash, contractAddress: receipt?.contractAddress, txUrl: `https://${chainId}.etherscan.io/tx/${receipt?.hash}` };}
With this setup, you can securely connect to multiple blockchain networks and perform transactions from your backend services using Sequence.